package com.example.librarymanagement.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.librarymanagement.dao.BorrowRecordMapper;
import com.example.librarymanagement.dto.borrowrecord.BorrowRecordListDto;
import com.example.librarymanagement.entity.BorrowRecord;
import com.example.librarymanagement.service.IBorrowRecordService;
import com.example.librarymanagement.vo.BorrowRecordVo;
import org.springframework.stereotype.Component;

/**
 * @author LQS
 */
@Component
public class BorrowRecordServiceImpl extends ServiceImpl<BorrowRecordMapper, BorrowRecord> implements IBorrowRecordService {
    @Override
    public IPage<BorrowRecordVo> getBookBorrow(BorrowRecordListDto borrowRecordListDto) {
        Page<BorrowRecordVo> page = new Page<>(borrowRecordListDto.getCurrent(), borrowRecordListDto.getSize());
        return baseMapper.getBookBorrow(page, borrowRecordListDto);
    }

    @Override
    public IPage<BorrowRecordVo> getPeriodicalBorrow(BorrowRecordListDto borrowRecordListDto) {
        Page<BorrowRecordVo> page = new Page<>(borrowRecordListDto.getCurrent(), borrowRecordListDto.getSize());
        return baseMapper.getPeriodicalBorrow(page, borrowRecordListDto);
    }

}
